﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace BDSim
{
    public class CSatelliteDLL
    {
        /// <summary>
        /// 轨道积分初始化
        /// </summary>
        /// <param name="pInput"></param>
        /// <param name="pParam"></param>
        /// <param name="pOutput"></param>
        /// <returns>1计算正确，-1表示当前计算时间没有行星历表，-4表示数据发散 </returns>
        [DllImport("CSatelliteDLL.dll", EntryPoint = "OrbitPredict_init", CallingConvention = CallingConvention.Cdecl)]
        public static extern int OrbitPredict_init(OrbitPredict_Input pInput, OrbitPredict_Param pParam, out OrbitPredict_Output pOutput);

        /// <summary>
        /// 轨道积分
        /// </summary>
        /// <param name="pInput"></param>
        /// <param name="pOutput"></param>
        /// <returns>1计算正确，-1表示当前计算时间没有行星历表，-4表示数据发散，-5表示时间或者积分步长输入不合理</returns>
        [DllImport("CSatelliteDLL.dll", EntryPoint = "OrbitPredict_output", CallingConvention = CallingConvention.Cdecl)]
        public static extern int OrbitPredict_output(OrbitPredict_Input pInput, out OrbitPredict_Output pOutput);

        //轨道插值
        [DllImport("CSatelliteDLL.dll", EntryPoint = "KSGTRP", CallingConvention = CallingConvention.Cdecl)]
        public static extern NodePosVel KSGTRP(
                               int m, int n,			//常数m=14，n=3
                               double trpTime,			//需要差值的时刻(相对时间，单位秒)
                               BackDiff backdiff);		//差值时刻所在积分段的后插表 
    }
}
